package com.cz.nongyetongv5.bean;

import java.io.Serializable;

import com.cz.nongyetongv5.utils.CharsetUtil;

public class RecordHistory implements Serializable {

	private String id;

	private String beiJianName;

	private String jianGuanName;

	private String renYuan;

	private String chanPin;

	private String time;

	private Integer result;

	private String imageUrl;

	// private boolean isFromJianGuanDuiXinag = false;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getBeiJianName() {
		return beiJianName;
	}

	public void setBeiJianName(String beiJianName) {
		this.beiJianName = beiJianName;
	}

	public String getJianGuanName() {
		return jianGuanName;
	}

	public void setJianGuanName(String jianGuanName) {
		this.jianGuanName = jianGuanName;
	}

	public String getRenYuan() {
		return renYuan;
	}

	public void setRenYuan(String renYuan) {
		this.renYuan = renYuan;
	}

	public String getChanPin() {
		return chanPin;
	}

	public void setChanPin(String chanPin) {
		this.chanPin = chanPin;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public Integer getResult() {
		return result;
	}

	public void setResult(Integer result) {
		this.result = result;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	/**
	 * 根据结果返回字体的颜色
	 *
	 * @return
	 */
	public String getColor() {

		//		if (isFromJianGuanDuiXinag) {
		//			if (result == 1) {
		//				return "#32A35E";
		//			} else {
		//				return "#ffff0000";
		//			}
		//
		//		}

		// 产品检测
		if (CharsetUtil.isNotNull(this.chanPin)) {

			// if (result == 0) {
			// return "#ffff0000";
			// } else {
			// return "#32A35E";
			// }

			if (result <= 1) {
				return "#32A35E";
			} else {
				return "#ffff0000";
			}

		} else {
			// 监督检查
			if (result == 1) {
				return "#32A35E";
			}

			if (result == 2) {
				return "#F4C82D";

			}

			if (result == 3) {
				return "#ffff0000";
			}

		}

		return "";

	}

	/**
	 * 返回结果的字符串形式
	 *
	 * @return
	 */
	public String getResultString() {

		// if (isFromJianGuanDuiXinag){
		// if (result == 1) {
		// return "合格";
		// } else {
		// return "不合格";
		// }
		//
		// }

		// 产品检测
		if (CharsetUtil.isNotNull(this.chanPin)) {

			if (result <= 1) {
				return "合格";
			} else {
				return "不合格";
			}

		} else {
			// 监督检查
			if (result == 1) {

				return "合格";

			}

			if (result == 2) {

				return "基本合格";

			}

			if (result == 3) {

				return "不合格";
			}

		}

		return "";

	}

	//	public boolean isFromJianGuanDuiXinag() {
	//		return isFromJianGuanDuiXinag;
	//	}
	//
	//	public void setFromJianGuanDuiXinag(boolean isFromJianGuanDuiXinag) {
	//		this.isFromJianGuanDuiXinag = isFromJianGuanDuiXinag;
	//	}

}
